<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        #box{
            position: absolute;
        }
        #msg{
            width: 100px;
            height: 50px;
            position: absolute;
            top: 10px;
            left: 10px;
            color: #f00;
            font-size: 50px;
            z-index: 99;
        }
        #gg{
             width: 200px;
             height: 100px;
             background-color: #fed;
             position: absolute;
             top: 30%;
             left: 30%;
             font-size: 30px;
             display: none;
        }
    </style>
</head>
<body>
    <h1>HTML5事件  拷贝/剪切/粘贴</h1>
    <hr>

    <p oncopy="copy()">日照香炉生紫烟,遥看瀑布挂前川.</p>

    <input type="text" value="请剪切我!" oncut="cut()">
    <p id="box1"></p>
    <input type="text" onpaste="paste()" placeholder="请粘贴在此处">

    <hr>
    <br>
    <br>


    <h1>播放/暂停/结束  音频</h1>
    <font color="red" size="7" id="info">操作</font>

    <audio controls onplay="b()" onpause="z()" onended="t()">
        <source src="./media/we will rock you.mp3" type="audio/mpeg">
            浏览器不支持 audio 标签
    </audio>

    <hr>

    <div id="box">
        <video id="vv" controls onplay="bf()" onpause="zt()" onended="tz()" width="600">
            <source src="./media/君の名は.BDrip 1920x1080 HEVC-YUV420P10 FLAC.mp4" type="video/mp4">
                浏览器不支持 video 标签
        </video>
        <div id="msg">操作</div>
        <div id="gg">我是广告 <br>猛戳立即购买</div>
    </div>

    <script>
        // oncopy 拷贝内容时触发
        function copy() {
            alert('已复制成功');
        }
        // oncut 剪切内容时触发
        function cut() {
            box1.innerHTML = '剪切成功!';
        }
        // onpaste 粘贴内容触发
        function paste() {
            box1.innerHTML = '粘贴成功!';
        }

        function b() {
            info.innerHTML = '播放';
        }
        function z() {
            info.innerHTML = '暂停';
        }
        function t() {
            info.innerHTML = '停止';
        }

        function bf() {
            msg.innerHTML = '开始';
            gg.style.display = 'none';
        }
        function zt() {
            msg.innerHTML = '暂停';
            gg.style.display = 'block';
        }
        function tz() {
            msg.innerHTML = '停止';
        }

        vv.onclick = function() {
            if (vv.paused) {
                vv.play();
                gg.style.display = 'none';
            } else {
                vv.pause();
                gg.style.display = 'block';
            }
        }
    </script>
</body>
</html>